Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

feat(linky): Allow optional 'target' argument. #1446

Closed
wants to merge 1 commit into from

Conversation

zdexter
Copy link
Contributor

@zdexter zdexter commented Oct 9, 2012

Closes #1443.

@pkozlowski-opensource
Copy link
Member

@zdexter Zach, this one looks good, apart from the missing curly brackets. Do you think you could amend the commit?

Also, did you sign the CLA already?

For individuals (a simple click-through form):
http://code.google.com/legal/individual-cla-v1.0.html

For corporations (print, sign and scan+email, fax or mail):
http://code.google.com/legal/corporate-cla-v1.0.html"

@zdexter
Copy link
Contributor Author

zdexter commented Nov 12, 2012

@pkozlowski-opensource Thanks for pointing that out; I've amended the commit, run tests, and pushed. Also, yes, I did sign the CLA back when I opened the pull request.

Good question about checking for undefined vs a falsy value when determining the presence of an optional argument. I looked into it and couldn't find a good programmatic reason to choose one over the other. But there is one edge case - it seems falsy values should be invalid, but actually, this is not true with iFrame names in HTML. Someone could conceivably have a frame name that evaluates to a falsy value. I tested this with an iFrame where name="0", and sure enough, Chrome considered "0" considered falsy even though it was a valid frame name. So I left in the check for undefined.

@pkozlowski-opensource
Copy link
Member

@zdexter Thnxk for taking care of this one and signing CLA. For the undefined testing you could eventually use angular's isUndefined.

@zdexter
Copy link
Contributor Author

zdexter commented Nov 18, 2012

@pkozlowski-opensource isDefined is only available in linky.js via "angular.isDefined". Is it okay to reference the function that way? If so, I can amend the commit with the tested update.

@petebacondarwin
Copy link
Contributor

angular.isDefined is an appropriate public API. ngResource module uses it
this way:
https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js#L289

On 18 November 2012 16:15, Zach Dexter notifications@github.com wrote:

@pkozlowski-opensource https://github.com/pkozlowski-opensourceisDefined is only available in linky.js via "angular.isDefined". Is it okay
to reference the function that way? If so, I can amend the commit with the
tested update.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1446#issuecomment-10487715.

@zdexter
Copy link
Contributor Author

zdexter commented Nov 24, 2012

Thanks. Amended commit to use angular.isDefined(), unit and scenario tested, and pushed.

@@ -82,7 +98,7 @@ angular.module('ngSanitize').filter('linky', function() {
var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}\<\>]/,
MAILTO_REGEXP = /^mailto:/;

return function(text) {
return function(text,target) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add space after comma

@IgorMinar
Copy link
Contributor

otherwise this looks good

@IgorMinar
Copy link
Contributor

I made some changes and landed this as 610927d

thanks a lot! if you don't have our t-shirt yet please fill out this form: http://goo.gl/075Sj

@IgorMinar IgorMinar closed this Nov 24, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

linky should support target=blank.
4 participants